<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/



/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

Route::group(['middleware' => ['web']], function () {

    Route::get("/index","Index\IndexController@index");  //首页
    Route::get("/login","Index\IndexController@userLogin");//客户登录页面
    Route::post("/_login","Index\IndexController@_userLogin");  //执行客户登录
    Route::get("/logout","Index\IndexController@userLogout");  //客户退出登录
    Route::get("/register","Index\IndexController@userRegister");//客户注册
    Route::post("/_register","Index\IndexController@_userRegister");//执行客户注册
    Route::post("/nameSelect","Index\IndexController@nameSelect");
    Route::post("/classSelect","Index\IndexController@classSelect");

    Route::get('/goodsInfo/{goods_id}','Index\IndexController@goodsInfo');//商品详情
    Route::get('/goodsShop/{business_id}','Index\IndexController@goodsShop');//进入店铺

    Route::get("/adminLogin","Admin\AdminController@adminLogin");  //管理员登录
    Route::post("/adminLogins","Admin\AdminController@adminLogins");  //管理员登录
    Route::get("/adminLogout","Admin\AdminController@adminLogout");  //管理员退出登录

    Route::get('/businessLogin','Business\BusinessController@businessLogin'); //商家登录
    Route::post('/_businessLogin','Business\BusinessController@_businessLogin'); //商家登录
    Route::get('/businessRegister','Business\BusinessController@businessRegister'); //商家注册
    Route::post('/_businessRegister','Business\BusinessController@_businessRegister'); //商家注册
    Route::get('/businessLogout','Business\BusinessController@businessLogout');  //商家退出登录

    //管理员
    Route::group(['middleware' => ['LoginAdminCheck']], function () {
        Route::get("/searchBusiness","Admin\AdminController@searchBusiness");//查看商家
        Route::get("/searchClass","Admin\AdminController@searchClass");//查看种类
        Route::post("/addClass","Admin\AdminController@addClass");//添加种类
        Route::get('/delClass','Admin\AdminController@delClass'); //删除种类


    });

    //商家
    Route::group(['middleware' => ['LoginBusinessCheck']], function () {
        Route::get('/myGoods','Business\ShopController@myGoods'); //查看自己的商品
        Route::post('/addGoods','Business\ShopController@addGoods'); //上架商品
        Route::get('/delGoods','Business\ShopController@delGoods'); //下架商品
        Route::post('/upGoods','Business\ShopController@upGoods'); //修改商品
        Route::get('/moreGoods/{goods_id}','Business\ShopController@moreGoods');//商品详情
        Route::get('/getOrder','Business\ShopController@getOrder');//收到的订单
        Route::get('/sendOrder/{goods_id}','Business\ShopController@sendOrder');//发货
        Route::get('/searchMoney','Business\ShopController@searchMoney');//查看收入
        Route::get("/searchClass","Business\ShopController@searchClass");//查看种类
        Route::post("/addClass","Business\ShopController@addClass");//添加种类
        Route::get('/delClass','Business\ShopController@delClass'); //删除种类
    });



    //客户登录
    Route::group(['middleware' => ['LoginUserCheck']], function () {
        Route::post("/add_goods_car","Index\IndexController@add_goods_car");//客户收藏商品
        Route::post("/del_goods_car","Index\IndexController@del_goods_car");//客户取消收藏商品
        Route::get("/goods_car","Index\IndexController@goods_car"); //收藏夹
        Route::post("/order_goods","Index\OrderController@order_goods"); //购买商品
        Route::get("/goods_order","Index\OrderController@goods_order"); //我的订单
        Route::post("/toOrder","Index\OrderController@toOrder"); //确认收货
        Route::post("/addEva","Index\OrderController@addEva"); //客户添加评价
    });



});
